package cn.edu.controller;

import cn.edu.domain.*;
import cn.edu.service.Col_TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/Col_Teacher")
public class Col_TeacherController {
    @Autowired
     private Col_TeacherService teacherService;
    //分页查询
    @PostMapping("/{currentPage}/{pageSize}/{academyName}")
    public Result selectByPage(@PathVariable Integer currentPage,
                               @PathVariable Integer pageSize,
                               @PathVariable String academyName,
                               @RequestBody All t){

        PageBean<All> pageBean = teacherService.selectByPageAndcondition(currentPage, pageSize,academyName,t);
      return new Result(Code.GET_OK,pageBean);
    }
    /*删除教师*/
    @DeleteMapping("/{id}")
    public Result delteacher(@PathVariable Integer id) {

        teacherService.delteacher(id);
        return new Result(Code.DELETE_OK,"ok");
    }
    /*修改教师*/
    @PutMapping
        public Result UpdateTeacher(@RequestBody All t){
        teacherService.Updateteacher(t);
         return new Result(Code.UPDATE_OK,"ok");
    }

    @RequestMapping("/Thesis")
    public Result  getThesisList(Integer id) {
        List<thesis> thesislist = teacherService.getThesis(id);
    return new Result(Code.GET_OK,thesislist);

    }
    @RequestMapping("/Research_project")
    public Result  getResearch_project( Integer id) {
        List<research_project> research_project = teacherService.getResearch_project(id);
        return new Result(Code.GET_OK,research_project);

    }
    @RequestMapping("/Annual_examination")
    public Result  getAnnual_examination(Integer id) {
        List<annual_examination> annual_examination = teacherService.getAnnual_examination(id);
        return new Result(Code.GET_OK,annual_examination);

    }

    @RequestMapping("/Award")
    public Result  getAward( Integer id) {
        List<award> award = teacherService.getAward(id);
        return new Result(Code.GET_OK,award);

    }
    @RequestMapping("/Honor")
    public Result  getHonor( Integer id) {
        List<honor_title> honor_title = teacherService.getHonor_title(id);
        return new Result(Code.GET_OK,honor_title);

    }
    @RequestMapping("/Opus")
    public Result  getOpus(Integer id) {
        List<opus> opus = teacherService.getOpus(id);
        return new Result(Code.GET_OK,opus);
    }
    @RequestMapping("/Teach_work")
    public Result  getTeach_work( Integer id) {
        List<teach_work> teach_work = teacherService.getTeach_work(id);
        return new Result(Code.GET_OK,teach_work);
    }
    @RequestMapping("/Train")
    public Result  getTrain( Integer id) {
        List<train> train = teacherService.getTrain(id);
        return new Result(Code.GET_OK,train);
    }
    @RequestMapping("/Patent")
    public Result  getPatent( Integer id) {
        List<patent> patent =teacherService.getPatent(id);
        return new Result(Code.GET_OK,patent);
    }
    @RequestMapping("/Work")
    public Result  getWork( Integer id) {
        List<work> work = teacherService.getWork(id);
        return new Result(Code.GET_OK,work);
    }


}
